#ifndef JSON_UTIL_H
#define JSON_UTIL_H
#include "JSONData.h"

namespace simframework
{
	namespace json
	{
		class JSONUtil
		{
		public:
			JSONUtil(void);
			~JSONUtil(void);

			static SimWString	 getKey(SimWStringIter& startIt, SimWStringIter& endIt);
			static void			 skipValue(SimWStringIter& startIt, SimWStringIter& endIt);
			static void			 skipString(SimWStringIter& startIt, SimWStringIter& endIt);
			static void			 skipNumber(SimWStringIter& startIt, SimWStringIter& endIt);
			static void			 skipBoolean(SimWStringIter& startIt, SimWStringIter& endIt);
			static void			 skipObjectOrArray(SimWStringIter& startIt, SimWStringIter& endIt);
			static void			 removeSpaces(SimWStringIter& startIt, SimWStringIter& endIt);
			static void			 cleanUp(SimWStringIter& startIt, SimWStringIter& endIt);

			static JSON_Object*	 getObjectValue(SimWStringIter& startIt, SimWStringIter& endIt, int* error);
			static JSON_Array*	 getArrayValue(SimWStringIter& startIt, SimWStringIter& endIt, int* error);
			static JSON_String*	 getStringValue(SimWStringIter& startIt, SimWStringIter& endIt, int* error);
			static JSON_Float*	 getFloatValue(SimWStringIter& startIt, SimWStringIter& endIt, int* error);
			static JSON_Integer* getIntValue(SimWStringIter& startIt, SimWStringIter& endIt, int* error);
			static JSON_Boolean* getBooleanValue(SimWStringIter& startIt, SimWStringIter& endIt, int* error);

			static bool			 isDigit(wchar_t& c);
			static bool			 checkPatternString(SimWString& pattern, SimWStringIter& startIt, SimWStringIter& endIt);
			static JSON_Object*	 getObjectElementById(unsigned int elemId, unsigned int& start, 
				SimWStringIter& startIt, SimWStringIter& endIt);
			static JSON_Array*	 getArrayElementById(unsigned int elemId, unsigned int& start, 
				SimWStringIter& startIt, SimWStringIter& endIt);
			static JSON_String*	 getStringElementById(unsigned int elemId, unsigned int& start, 
				SimWStringIter& startIt, SimWStringIter& endIt);
			static JSON_Float*	 getFloatElementById(unsigned int elemId, unsigned int& start, 
				SimWStringIter& startIt, SimWStringIter& endIt);
			static JSON_Integer* getIntElementById(unsigned int elemId, unsigned int& start, 
				SimWStringIter& startIt, SimWStringIter& endIt);
			static JSON_Boolean* getBooleanElementById(unsigned int elemId, unsigned int& start, 
				SimWStringIter& startIt, SimWStringIter& endIt);
			static JSON_Abstract* getDefault(JSON_Type& type);
		};
	}
}

#endif